feat(openidConnect): auto-detect and apply PKCE from OIDC discovery#640
Open
peyremorgan wants to merge 2 commits intomarkbates:masterfrom
Open
feat(openidConnect): auto-detect and apply PKCE from OIDC discovery#640peyremorgan wants to merge 2 commits intomarkbates:masterfrom
peyremorgan wants to merge 2 commits intomarkbates:masterfrom
Conversation
When the OIDC discovery document advertises code_challenge_methods_supported, the provider now automatically: - Selects the best method (S256 preferred over plain per RFC 7636 §4.2) - Generates a cryptographically random code_verifier on each BeginAuth call - Computes the code_challenge and injects it into the authorization URL - Stores the code_verifier in the Session for use at token exchange - Uses the stored verifier in Authorize(), falling back to the legacy code_verifier query param for backward compatibility If code_challenge_methods_supported is absent or empty, PKCE is not applied.
Author
|
Okay, marking this as WIP because #636 uses another approach (imports "golang.org/x/oauth2") and I think we should converge on a single implementation style for both. |
Replace custom generateCodeVerifier and generateS256Challenge helpers with oauth2.GenerateVerifier(), oauth2.S256ChallengeOption(), oauth2.VerifierOption(), and oauth2.S256ChallengeFromVerifier() from golang.org/x/oauth2 v0.30.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the OIDC discovery document advertises code_challenge_methods_supported, the provider now automatically:
If code_challenge_methods_supported is absent or empty, PKCE is not applied.
Fixes #639